/*
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:lib_runtime/lib_runtime.dart';
import 'package:lib_basemodel/server_client/message.pb.dart';
import 'package:m_chatroom/src/template/barrage/item/barrage_item.dart';
import 'item/push_putroom_item.dart';
import 'item/push_sendgift_item.dart';
import 'item/push_userjoin_item.dart';
import 'item/push_text_item.dart';
import 'socket_message_row_builder.dart';

mixin BarrageItemBuilder {
  ValueChanged<int> get onSenderTap;
  Widget buildItem(BuildContext context, Message msg) => const Text(T.current!.upgrade_unknown_msg);
}

class RoomMessageItemBuilder extends SocketMessageRowBuilder {
  Function? callBack;
  RoomMessageItemBuilder({this.callBack});

  @override
  Widget buildRow(BuildContext context, Message message,int index) {
    return _buildCustomMessageItem(context, message);
  }

  Widget _buildCustomMessageItem(BuildContext context, Message message) {

    if(message.data.scene == Scene.ROOM_CHAT) {
      return BarrageItem(message: message,callBack: (value){
        callBack?.call(value);
      });
    }

    //加入房间
    if (message.data.scene == Scene.USER_JOIN) {
      //加入房间弹幕
      return PushUserJoinItem(message: message, callBack: (value) {
          callBack?.call(value);
        },
      );
    }

    // 送礼物
    if (message.data.scene == Scene.SEND_GIFT) {
      return PushSendGiftItem(message: message,callBack: (value) {
          callBack?.call(value);
        },
      );
    }

    // 聊天室管理的系统消息
    if(message.data.scene == Scene.MANAGER_OPERATION){
      return PushTextItem(message: message,callBack: (value){
        callBack?.call(value);
      },);
    }

    //房间分享
    if(message.data.scene == Scene.SHARE){
       return PushPutRoomItem(message: message,callBack: (value){
         callBack?.call(value);
       },);
    }

    return Container(
      child: Text("22222"),
    );
  }
}
*/
